package zzk.test.controller;

import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import zzk.base.mybatisPlus.controller.MyBaseController;
import zzk.test.domain.User;
import zzk.test.service.UserService;



/**
 * 功能描述：TUserController 前端控制器
 *
 * @author ：86188
 * 创建日期 ：
 * <p>
 * 修改历史：(修改人，修改时间，修改原因/内容)
 */

@RestController
@RequestMapping("/mybatis")
public class UserController extends MyBaseController {
    private Logger logger = LoggerFactory.getLogger(getClass());

    @Resource
    private UserService tUserService;


    @RequestMapping("/getById")
    public User getById(int id) {
        return this.tUserService.getById(id);
    }

    @RequestMapping("/getByIdSelf")
    public User getByIdSelf(int id) {
        return this.tUserService.getByIdSelf(id);
    }


    @RequestMapping("/save")
    public String save(HttpServletRequest request) {
        User user = new User();
        user.setAge(11);
        user.setName("小黄");
        user.setIsDeleted("1");
        this.tUserService.save(user);
        return "成功";
    }

    @RequestMapping("/saveSelf")
    public String saveSelf(HttpServletRequest request) {
        User user = new User();
        user.setAge(11);
        user.setName("小黄");
        user.setIsDeleted("1");
        this.tUserService.saveSelf(user);
        return "成功";
    }


}
